package com.shxc.smarttrade.old.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.shxc.smarttrade.R;
import com.shxc.smarttrade.old.adapter.FootOneAdapter;

/**
 * Created by jcdev1 on 2017/5/9.
 */

public class DynamicTradingFragment extends Fragment {

    private View rootView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {

        if (rootView == null) {
            rootView = inflater.inflate(R.layout.fragment_dynamic_trading, null);
        }
        //缓存的rootView需要判断是否已经被加过parent， 如果有parent需要从parent删除，要不然会发生这个rootview已经有parent的错误。
        ViewGroup parent = (ViewGroup) rootView.getParent();
        if (parent != null) {
            parent.removeView(rootView);
        }
        ListView lvPosition=(ListView) rootView.findViewById(R.id.lv_position);
        lvPosition.setAdapter(new FootOneAdapter(getContext()));
        return rootView;
    }
}
